package senior.ListExer.Exer2;

import java.util.Objects;

/**
 * @author shkstart
 * @creat 2022-04-13:37
 */
public class Employee {
    private String name;//姓名
    private String no;//工号
    private int salary;//工资


    public Employee() {
    }

    public Employee(String no) {
        this.no = no;
    }

    public Employee(String name, String no, int salary) {
        this.name = name;
        this.no = no;
        this.salary = salary;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public int getSalary() {
        return salary;
    }

    public void setSalary(int salary) {
        this.salary = salary;
    }

    @Override
    public String toString() {
        return "姓名：" + name +
                ", 工号：" + no +
                ", 工资：" + salary + "元";
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Employee employee = (Employee) o;
        return Objects.equals(no, employee.no);
    }

    @Override
    public int hashCode() {
        return Objects.hash(no);
    }
}
